﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FFS.Model;
using FFS.BLL;

namespace FFS
{
    public partial class frmDatabaseBackup : Form
    {
        public frmDatabaseBackup()
        {
            InitializeComponent();
        }

        SystemToolsService sts = new SystemToolsService();

        private void frmDatabaseBackup_Load(object sender, EventArgs e)
        {
            string backupFileName = "";
            backupFileName =  sts.ManageSystemTools().GetDatabaseName()+"_"+DateTime.Now.ToString("yyyyMMddHHmmssfff")+".bak";
            this.txt_backupFullPath.Text = System.IO.Path.Combine(Application.StartupPath+"\\DBBackup\\", backupFileName);
        }

        private void btn_backup_Click(object sender, EventArgs e)
        {

            if (MessageBox.Show("确认要备份?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                sts.ManageSystemTools().BackupDatabase(this.txt_backupFullPath.Text,Context._Login_UserName);

                MessageBox.Show("备份完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();
            }
        }
    }
}
